@include HeaderView
@layout Layout
@section Title { Sheepshead Scores }
@section Scripts {
	<script src="SheepsheadScoreCtrl.js"></script>
}
@section Header {
	@html Partial<HeaderView>(ViewType::SubmitScores);
}
<div class="well" ng-controller="SheepsheadScoreCtrl" ng-cloak>
	<h2>Sheepshead Scores</h2>
	<form class="form-horizontal" role="form" action="/sheepshead.cgi" method="post">
		<div
			class="form-group"
			on-repeat-done="autocomplete"
			ng-repeat="playerScore in playerScores">
			<div class="col-sm-3">
				<input
					type="text"
					class="form-control name-lookup"
					name="{{playerScore.nameId}}"
					placeholder="Name"
					ng-model="playerScore.name"
					autocomplete="off">
			</div>
			<div class="col-sm-2">
				<input
					type="number"
					class="form-control"
					name="{{playerScore.scoreId}}"
					placeholder="Score"
					ng-model="playerScore.score">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-5">
				<p
					class="form-control-static"
					style="float: right;">
					P.S. {{getPositivePointSpread()}}
				</p>
				<button
					type="submit"
					class="btn btn-default btn-primary"
					ng-disabled="!isValid()">
					Submit
				</button>
				<button
					type="button"
					class="btn btn-link"
					ng-click="addPlayer()">
					+ Add a Player
				</button>
			</div>
		</div>
		<input type="hidden" name="playerCount" value="{{playerCount}}">
	</form>
	<div
		ng-show="getCheckSum()"
		class="alert alert-danger">
		Checksum is {{getCheckSum()}} instead of 0.
	</div>
</div>

